"""
Configuration management for CogView MCP Server.
"""

import os
from typing import Optional
from dotenv import load_dotenv

# Load environment variables from .env file
load_dotenv()

class Config:
    """Configuration class for CogView MCP Server."""
    
    # ZhipuAI API configuration
    ZHIPU_API_KEY: Optional[str] = os.getenv("ZHIPU_API_KEY")
    
    # Default models
    DEFAULT_COGVIEW_MODEL: str = "cogview-3-flash"
    DEFAULT_BG_REMOVAL_MODEL: str = "u2net"
    
    # Default image size
    DEFAULT_IMAGE_SIZE: str = "1024x1024"
    
    # Server configuration
    SERVER_NAME: str = "cogview-mcp-server"
    SERVER_VERSION: str = "1.0.0"
    
    @classmethod
    def validate(cls):
        """Validate required configuration."""
        if not cls.ZHIPU_API_KEY:
            raise ValueError("ZHIPU_API_KEY is required. Please set it in environment variables or .env file")
    
    @classmethod
    def get_available_cogview_models(cls) -> list[str]:
        """Get list of available CogView models."""
        return ["cogview-3-flash"]
    
    @classmethod
    def get_available_image_sizes(cls) -> list[str]:
        """Get list of available image sizes for CogView."""
        return ["1024x1024", "768x1024", "1024x768", "1152x896", "896x1152", "1216x832", "832x1216", "1344x768", "768x1344", "1536x640", "640x1536"]
    
    @classmethod
    def get_available_bg_removal_models(cls) -> list[str]:
        """Get list of available background removal models."""
        return ["u2net", "u2netp", "u2net_human_seg", "silueta"]
